package main

import (
	"flag"
	"github.com/labstack/echo/v4"
	"github.com/labstack/echo/v4/middleware"
	"github.com/swaggo/echo-swagger"
	_ "law_case_api/docs"
	"law_case_api/models"
	"law_case_api/routing"
)

// @title 项目接口文档
// @version 1.0
// @description 这里是描述
// @host 10.11.12.28:80
func main() {
	flag.Parse()

	e := echo.New()
	//swagger文档
	e.GET("/swagger/*", echoSwagger.WrapHandler)
	//中间件
	e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
		Format: "method=${method}, uri=${uri}, status=${status}\n",
	}))
	r := e.Group("/wzj")
	routing.NotAuthRoute(r)
	//登陆jwt认证中间件
	config := middleware.JWTConfig{
		Claims:     &models.JwtCustomClaims{},
		SigningKey: []byte("secret"),
	}
	r.Use(middleware.JWTWithConfig(config))
	routing.AuthRoute(r)

	e.Logger.Fatal(e.Start(":10001"))
}
